home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-05-01 | 13.6 KB | 458 lines | [TEXT/MPS ] |
- ;
- ; File: DBDMA.a
- ;
- ; Contains: Descriptor Based DMA Interfaces
- ;
- ; Version: Technology: System 7.5
- ; Release: Universal Interfaces 3.0d3 on Copland DR1
- ;
- ; Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
- ;
- ; Bugs?: If you find a problem with this file, send the file and version
- ; information (from above) and the problem description to:
- ;
- ; Internet: apple.bugs@applelink.apple.com
- ; AppleLink: APPLE.BUGS
- ;
- ;
- IF &TYPE('__DBDMA__') = 'UNDEFINED' THEN
- __DBDMA__ SET 1
-
- IF &TYPE('__CONDITIONALMACROS__') = 'UNDEFINED' THEN
- include 'ConditionalMacros.a'
- ENDIF
- IF &TYPE('__PCI__') = 'UNDEFINED' THEN
- include 'PCI.a'
- ENDIF
- IF FOR_SYSTEM8_PREEMPTIVE THEN
- IF &TYPE('__CODEFRAGMENTS__') = 'UNDEFINED' THEN
- include 'CodeFragments.a'
- ENDIF
- IF &TYPE('__DRIVERSERVICES__') = 'UNDEFINED' THEN
- include 'DriverServices.a'
- ENDIF
- ENDIF
- IF FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE THEN
- ; These macros are are DBDMAChannelRegisters accessor functions.
-
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
- ; Macro: _SetChannelControl &a, &d
- ;
- ; In: &a Address register containing a pointer to a DB-DMA channel register set
- ; &d.L Data register containing a value to write to the ChannelControl register
- ;
- ; Notes: &d is not guaranteed to be preserved.
- ; The macro generates code for either big-endian or little-endian storage.
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
-
- macro
- _SetChannelControl &a, &d
-
- with DBDMAChannelRegisters
-
- _EndianSwap32Bit &d
- eieio
- move.l &d, channelControl(&a)
- eieio
-
- endwith
- endm
-
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
- ; Macro: _GetChannelStatus &a, &d
- ;
- ; In: &a Address register containing a pointer to a DB-DMA channel register set
- ; Out: &d.L Data register containing the ChannelStatus return value
- ;
- ; Notes: The macro generates code for either big-endian or little-endian storage.
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
-
- macro
- _GetChannelStatus &a, &d
-
- with DBDMAChannelRegisters
-
- move.l channelStatus(&a), &d
- _EndianSwap32Bit &d
-
- endwith
- endm
-
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
- ; Macro: _GetCommandPtr &a, &d
- ;
- ; In: &a Address register containing a pointer to a DB-DMA channel register set
- ; Out: &d.L Data register containing the CommandPtrLo return value
- ;
- ; Notes: The macro generates code for either big-endian or little-endian storage.
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
-
- macro
- _GetCommandPtr &a, &d
-
- with DBDMAChannelRegisters
-
- move.l commandPtrLo(&a), &d
- _EndianSwap32Bit &d
-
- endwith
- endm
-
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
- ; Macro: _SetCommandPtr &a, &d
- ;
- ; In: &a Address register containing a pointer to a DB-DMA channel register set
- ; &d.L Data register containing a value to write to the CommandPtrLo register
- ;
- ; Notes: &d is not guaranteed to be preserved.
- ; The macro generates code for either big-endian or little-endian storage.
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
-
- macro
- _SetCommandPtr &a, &d
-
- with DBDMAChannelRegisters
-
- _EndianSwap32Bit &d
- move.l &d, commandPtrLo(&a)
- eieio
-
- endwith
- endm
-
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
- ; Macro: _GetInterruptSelect &a, &d
- ;
- ; In: &a Address register containing a pointer to a DB-DMA channel register set
- ; Out: &d.L Data register containing the InterruptSelect return value
- ;
- ; Notes: The macro generates code for either big-endian or little-endian storage.
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
-
- macro
- _GetInterruptSelect &a, &d
-
- with DBDMAChannelRegisters
-
- move.l interruptSelect(&a), &d
- _EndianSwap32Bit &d
-
- endwith
- endm
-
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
- ; Macro: _SetInterruptSelect &a, &d
- ;
- ; In: &a Address register containing a pointer to a DB-DMA channel register set
- ; &d.L Data register containing a value to write to the InterruptSelect register
- ;
- ; Notes: &d is not guaranteed to be preserved.
- ; The macro generates code for either big-endian or little-endian storage.
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
-
- macro
- _SetInterruptSelect &a, &d
-
- with DBDMAChannelRegisters
-
- _EndianSwap32Bit &d
- move.l &d, interruptSelect(&a)
- eieio
-
- endwith
- endm
-
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
- ; Macro: _GetBranchSelect &a, &d
- ;
- ; In: &a Address register containing a pointer to a DB-DMA channel register set
- ; Out: &d.L Data register containing the BranchSelect return value
- ;
- ; Notes: The macro generates code for either big-endian or little-endian storage.
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
-
- macro
- _GetBranchSelect &a, &d
-
- with DBDMAChannelRegisters
-
- move.l branchSelect(&a), &d
- _EndianSwap32Bit &d
-
- endwith
- endm
-
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
- ; Macro: _SetBranchSelect &a, &d
- ;
- ; In: &a Address register containing a pointer to a DB-DMA channel register set
- ; &d.L Data register containing a value to write to the BranchSelect register
- ;
- ; Notes: &d is not guaranteed to be preserved.
- ; The macro generates code for either big-endian or little-endian storage.
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
-
- macro
- _SetBranchSelect &a, &d
-
- with DBDMAChannelRegisters
-
- _EndianSwap32Bit &d
- move.l &d, branchSelect(&a)
- eieio
-
- endwith
- endm
-
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
- ; Macro: _GetWaitSelect &a, &d
- ;
- ; In: &a Address register containing a pointer to a DB-DMA channel register set
- ; Out: &d.L Data register containing the WaitSelect return value
- ;
- ; Notes: The macro generates code for either big-endian or little-endian storage.
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
-
- macro
- _GetWaitSelect &a, &d
-
- with DBDMAChannelRegisters
-
- move.l waitSelect(&a), &d
- _EndianSwap32Bit &d
-
- endwith
- endm
-
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
- ; Macro: _SetWaitSelect &a, &d
- ;
- ; In: &a Address register containing a pointer to a DB-DMA channel register set
- ; &d.L Data register containing a value to write to the WaitSelect register
- ;
- ; Notes: &d is not guaranteed to be preserved.
- ; The macro generates code for either big-endian or little-endian storage.
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
-
- macro
- _SetWaitSelect &a, &d
-
- with DBDMAChannelRegisters
-
- _EndianSwap32Bit &d
- move.l &d, waitSelect(&a)
- eieio
-
- endwith
- endm
-
-
- ; These macros are DBDMADescriptor accessor functions.
-
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
- ; Macro: _MakeCCDescriptor &a, &op, &addr
- ;
- ; In: &a Address register containing a pointer to a DBDMADescriptor
- ; &op.L Data register containing a catenated command and reqCount
- ; &addr.L Data register containing a physical DMA address
- ;
- ; Notes: &op/&addr are not guaranteed to be preserved.
- ; The macro generates code for either big-endian or little-endian storage.
- ; The command field must be written to memory last for STOP replacement.
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
-
- macro
- _MakeCCDescriptor &a, &op, &addr
-
- with DBDMADescriptor
-
- _EndianSwap32Bit &addr
- move.l &addr,address(&a) ; address
- clr.l cmdDep(&a) ; cmdDep is frequently reserved
- clr.l result(&a) ; initialize status and residual count
- sync
-
- _EndianSwap32Bit &op
- move.l &op,operation(&a) ; command and count
- sync
-
- endwith
- endm
-
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
- ; Macro: _MakeCmdDepCCDescriptor &a, &op, &addr, &dep
- ;
- ; In: &a Address register containing a pointer to a DBDMADescriptor
- ; &op.L Data register containing a catenated command and reqCount
- ; &addr.L Data register containing a physical DMA address
- ; &dep.L Data register containing a physical DMA address
- ;
- ; Notes: &op/&addr/&dep are not guaranteed to be preserved.
- ; The macro generates code for either big-endian or little-endian storage.
- ; The command field must be written to memory last for STOP_CMD replacement.
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
-
- macro
- _MakeCmdDepCCDescriptor &a, &op, &addr, &dep
-
- with DBDMADescriptor
-
- _EndianSwap32Bit &addr
- move.l &addr,address(&a) ; address
- _EndianSwap32Bit &dep
- move.l &dep,cmdDep(&a) ; cmdDep is frequently reserved
- clr.l result(&a) ; initialize status and residual count
- sync
-
- _EndianSwap32Bit &op
- move.l &op,operation(&a) ; command and count
- sync
-
- endwith
- endm
-
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
- ; Macro: _GetCCOperation &a, &d
- ;
- ; In: &a Address register containing a pointer to a DBDMADescriptor
- ; Out: &d.L Data register containing the canonical operation field read value
- ;
- ; Notes: The macro generates code for either big-endian or little-endian storage.
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
-
- macro
- _GetCCOperation &a, &d
-
- move.l DBDMADescriptor.operation(&a), &d
- _EndianSwap32Bit &d
-
- endm
-
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
- ; Macro: _SetCCOperation &a, &d
- ;
- ; In: &a Address register containing a pointer to a DBDMADescriptor
- ; &d.L Data register containing the canonical operation field write value
- ;
- ; Notes: &d.L is not guaranteed to be preserved.
- ; The macro generates code for either big-endian or little-endian storage.
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
-
- macro
- _SetCCOperation &a, &d
-
- _EndianSwap32Bit &d
- move.l &d, DBDMADescriptor.operation(&a)
-
- endm
-
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
- ; Macro: _GetCCAddress &a, &d
- ;
- ; In: &a Address register containing a pointer to a DBDMADescriptor
- ; Out: &d.L Data register containing the canonical address field read value
- ;
- ; Notes: The macro generates code for either big-endian or little-endian storage.
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
-
- macro
- _GetCCAddress &a, &d
-
- move.l DBDMADescriptor.address(&a), &d
- _EndianSwap32Bit &d
-
- endm
-
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
- ; Macro: _SetCCAddress &a, &d
- ;
- ; In: &a Address register containing a pointer to a DBDMADescriptor
- ; &d.L Data register containing the canonical address field write value
- ;
- ; Notes: &d.L is not guaranteed to be preserved.
- ; The macro generates code for either big-endian or little-endian storage.
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
-
- macro
- _SetCCAddress &a, &d
-
- _EndianSwap32Bit &d
- move.l &d, DBDMADescriptor.address(&a)
-
- endm
-
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
- ; Macro: _GetCCCmdDep &a, &d
- ;
- ; In: &a Address register containing a pointer to a DBDMADescriptor
- ; Out: &d.L Data register containing the canonical cmdDep field read value
- ;
- ; Notes: The macro generates code for either big-endian or little-endian storage.
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
-
- macro
- _GetCCCmdDep &a, &d
-
- move.l DBDMADescriptor.cmdDep(&a), &d
- _EndianSwap32Bit &d
-
- endm
-
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
- ; Macro: _SetCCCmdDep &a, &d
- ;
- ; In: &a Address register containing a pointer to a DBDMADescriptor
- ; &d.L Data register containing the canonical cmdDep field write value
- ;
- ; Notes: &d.L is not guaranteed to be preserved.
- ; The macro generates code for either big-endian or little-endian storage.
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
-
- macro
- _SetCCCmdDep &a, &d
-
- _EndianSwap32Bit &d
- move.l &d, DBDMADescriptor.cmdDep(&a)
-
- endm
-
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
- ; Macro: _GetCCResult &a, &d
- ;
- ; In: &a Address register containing a pointer to a DBDMADescriptor
- ; Out: &d.L Data register containing the canonical result field read value
- ;
- ; Notes: The macro generates code for either big-endian or little-endian storage.
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
-
- macro
- _GetCCResult &a, &d
-
- move.l DBDMADescriptor.result(&a),&d
- _EndianSwap32Bit &d
-
- endm
-
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
- ; Macro: _SetCCResult &a, &d
- ;
- ; In: &a Address register containing a pointer to a DBDMADescriptor
- ; &d.L Data register containing the canonical result field write value
- ;
- ; Notes: &d.L is not guaranteed to be preserved.
- ; The macro generates code for either big-endian or little-endian storage.
- ; ……………………………………………………………………………………………………………………………………………………………………………………………………………………
-
- macro
- _SetCCResult &a, &d
-
- _EndianSwap32Bit &d
- move.l &d, DBDMADescriptor.result(&a)
-
- endm
-
-
- ENDIF
- ENDIF ; __DBDMA__
-
-